{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "80b3e199-3e83-4a12-84fb-781e2d5b603f",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "全勤同学有：一一,二二,张三,"
     ]
    }
   ],
   "source": [
    "# 从csv文件中读取考勤数据\n",
    "ls = []\n",
    "for i in range(1,11):\n",
    "    fo =  open(str(i) +\".csv\",\"r\",encoding = \"utf-8\")\n",
    "    for line in fo:\n",
    "        line = line.replace(\"\\n\",\"\") \n",
    "        ls.append(line.split(\",\")[0])        \n",
    "    fo.close()\n",
    "counts = {}\n",
    "for name in ls:\n",
    "    counts[name] = counts.get(name,0) + 1\n",
    "items = list(counts.items()  )\n",
    "print(\"全勤同学有：\",end =\"\")\n",
    "for item in items:\n",
    "    word,count = item\n",
    "    if count == 10 :\n",
    "        print(word,end =\",\")\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "17bcbaba-db5e-49a8-975f-901b643abfb3",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "e5f0053f-4908-4db2-917f-562c07ea34c3",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
